/**
 * Creater with IntelliJ IDEA.
 * Description:
 * User: 86152
 * Dae: 2022-07-23
 * Time: 20:30
 */
class MyRunnable implements Runnable {
    @Override
    public void run() {
        while(!Thread.interrupted()) {
            System.out.println("正在执行");
        }
        System.out.println("执行中断");
    }
}
public class demo3 {
    public static void main(String[] args) throws InterruptedException {
        MyRunnable tar = new MyRunnable();
        Thread t = new Thread(tar);
        t.start();
        Thread.sleep(3000);
        t.interrupt();
        Thread.sleep(3000);
        t.start();
        Thread.sleep(3000);
    }
}